<template>
  <div>
    <el-page-header @back="goBack" content="返回首页"> </el-page-header>
    <el-row :gutter="20">
      <el-col :span="4">
        <div class="grid-content bg-purple">
          <!-- <el-radio-group
            v-model="isCollapse"
            style="margin-bottom: 20px; margin-left: -10%"
          >
            <el-radio-button :label="false">展开</el-radio-button>
            <el-radio-button :label="true">收起</el-radio-button>
          </el-radio-group> -->
          <!-- :collapse="isCollapse" -->
          <el-menu
            default-active="activeMenu"
            class="el-menu-vertical-demo"
            @select="handleMenuSelect"
            @open="handleOpen"
            @close="handleClose"
          >
            <el-menu-item index="1">
              <i class="el-icon-location"></i>
              <span slot="title">视频列表</span>
            </el-menu-item>
            <el-menu-item index="2">
              <i class="el-icon-user"></i>
              <span slot="title">用户信息</span>
            </el-menu-item>
            <el-menu-item index="3">
              <i class="el-icon-menu"></i>
              <span slot="title">菜单列表</span>
            </el-menu-item>
            <el-menu-item index="4">
              <i class="el-icon-setting"></i>
              <span slot="title">轮播信息</span>
            </el-menu-item>
          </el-menu>
        </div>
      </el-col>
      <el-col :span="18">
        <div class="grid-content bg-purple">
          信息列表

          <div v-if="selectIndex === '1'">
            <AdminInfo></AdminInfo>
          </div>
          <div v-else-if="selectIndex === '2'">
            <AdminUser></AdminUser>
          </div>
          <div v-if="selectIndex === '3'">
            <AdminMenu></AdminMenu>
          </div>
          <div v-else-if="selectIndex === '4'">
            <AdminCarousel></AdminCarousel>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<style>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}
</style>

<script>
import AdminInfo from "@/components/admin/AdminInfo.vue";
import AdminUser from "@/components/admin/AdminUser.vue";
import AdminMenu from "@/components/admin/AdminMenu.vue";
import AdminCarousel from "@/components/admin/AdminCarousel.vue";
import router from "@/router";
export default {
  data() {
    return {
      activeMenu: "1",
      // isCollapse: true,
      selectIndex: "1",
    };
  },
  components: {
    AdminInfo,
    AdminUser,
    AdminMenu,
    AdminCarousel,
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    handleMenuSelect(index) {
      this.selectIndex = index;
    },
    goBack() {
      router.push("/");
    },
  },
};
</script>
